using UnityEngine;
using System.Collections;

// affects attached objects' transform to follow a target, designed for camera control
public class CameraScript : MonoBehaviour {

    // Transform that the camera attempts to follow
    public Transform target;

    // Use this for initialization
    void Start () {
		DontDestroyOnLoad(transform.gameObject);
    }
    
    void Update () {
		if(target != null){
        // move with target
	        Vector3 temp = new Vector3(target.position.x,transform.position.y,target.position.z+100);
	        transform.position = temp;
	        
	        // look at target
	        transform.LookAt(target);
		}
    }
	public void setTarget(Transform tar){
		target = tar;
	}
}
